Ext.define("org.jks.AddInDevice", {
			extend : "Ext.window.Window",
			style:'border:1px solid #5bb6b1',
			border:false,
			closable : true,
			modal: true,
			width : 400,
			height : 120,
			closable : true,
			title : "入库",
			url: '',
			callback: undefined,
			successFunc: undefined,
			floating : true,
			initComponent : function() {
				var me = this;
				me.tdcode = Ext.create("Ext.form.field.Text",{
					margin: '5 5',
					labelWidth: 60,
					enableKeyEvents: true,
					allowBlank: false,
					selectOnFocus: true,
					fieldLabel : '二维码',
					listeners:{
						keyup: function(self, e, eOpts){
							if(e.getCharCode()==13){
								self.selectText();
							}
						}
					}
				});
				me.form = Ext.create("Ext.form.Panel",{
					border : false,
					layout: 'fit',
					margin: '5 5',
					items : [me.tdcode]
				});
				me.items = [me.form];
				me.okButton = Ext.create('Ext.button.Button', {
							text : '确定',
							handler : function() {
								me.inDevice();
							}
						});
				me.cancelButton = Ext.create('Ext.button.Button', {
							text : '取消',
							handler : function() {
								me.close();
							}
						});
				me.buttons = [me.okButton, me.cancelButton];
				me.callParent();
			},
			
			inDevice : function() {
				var me = this;
				if(me.form.isValid()){
					Ext.Ajax.request({
							url : me.url,
							params : {
								tdCode : me.tdcode.getValue()
							},
							callback : function(options, success, response) {
								if(success){
									var ar = Ext.decode(response.responseText);
									if(ar.success){
										if(!Ext.isEmpty(me.successFunc)){
											me.successFunc();
										}
										me.close();
									}
									else{
										Ext.Msg.alert('错误', ar.msg);
									}
								}
							}
						});
					
				}		
			},
			listeners:{
				show: function(self, eOpts){
					self.tdcode.focus();
				}
			}
		});